﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace AuthenticationAPI.Models
{
    public class userInfo
    {

        public userInfo()
        {
            this.freeze = 0;
        }




        public string userName { get; set; }
        public string authentication { get; set; }
        public string phone { get; set; }
        public string mail { get; set; }
        public string password { get; set; }
        public string realName { get; set; }
        public string corporation { get; set; }
        public string department { get; set; }
        public string avatar { get; set; }
        public int freeze { get; set; }
        public string wechatId { get; set; }
        /// <summary>
        /// 可以管理的用户部门
        /// </summary>
        public List<string> authorizedDepartments { get; set; }
        /// <summary>
        /// 可以分配的用户权限
        /// </summary>
        public List<string> authorzedLevel { get; set; }

        /// <summary>
        /// 可以拥有的权限项目列表
        /// </summary>
        public List<int> authorizedProjectList { get; set; }


        public static bool operator >(userInfo a1, userInfo a2)
        {
            var list = userInfo.authorList.ToList();
            var a1index = list.IndexOf(a1.authentication);
            var a2index = list.IndexOf(a2.authentication);
            return a1index < a2index;
        }

        public static bool operator <(userInfo a1, userInfo a2)
        {
            var list = userInfo.authorList.ToList();
            var a1index = list.IndexOf(a1.authentication);
            var a2index = list.IndexOf(a2.authentication);
            return a1index > a2index;
        }


        private static string[] authorList = new string[] { "Administrator", "Owner", "CorpAdministrator", "DepartAdministrator", "Manager", "User" };
    }
}